<template>
    <div style="display: inline-block;padding-right:10px;">
        <el-button size="mini" @click="open=true;loadData()">新闻列表</el-button>

        <el-dialog :title="title" :visible.sync="open" width="80%">

            <my-list ref="list" url="/cms/inner/list" :query="query" @loaded="procData" :page-size="pageSize"
                     :store="true">
                <el-table-column type="index" clign="center" width="50"></el-table-column>
                <!--<template slot-scope="scope"></template>-->
                <el-table-column label="名称" align="center">
                    <template slot-scope="scope">
                        <div class="link" @click="edit_click(scope.row)">{{scope.row.name}}</div>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="排序" prop="order"></el-table-column>
                <el-table-column align="center" label="是否显示" prop="status">
                    <template slot-scope="scope">
                        <el-tag  v-if="scope.row.status === true" >是</el-tag>
                        <el-tag  type="info" v-if="scope.row.status === false" >否</el-tag>
                    </template>
                </el-table-column>
                <el-table-column align="center" label="创建时间" prop="createAt"></el-table-column>
                <el-table-column label="操作" align="center" width="180">
                    <template slot-scope="scope">
                        <el-button @click="delete_click(scope.row)" size="small" type="danger">
                            删除
                        </el-button>
                    </template>
                </el-table-column>

                <template #query-button>
                    <el-button size="mini" @click="add_click">添加</el-button>
                </template>
            </my-list>
        </el-dialog>
    </div>
</template>

<script>
    /**
     * Created by CodeGenerator
     */
    export default {
        components: {},
        data() {
            return {
                //查询条件
                query: {
                    type: this.type
                },
                open: false,
                skip: 0,
                pageSize: 10,

                //格举
                //枚举：jv.枚举.getData(),
                StatisticsViewObjectEnum: jv.enum.StatisticsViewObjectEnum.getData()
            };
        },
        props: {
            type: {
                type: String, default: ""
            },
            info: {
                type: Object, default: () => {
                    return {}
                }
            }
        },
        computed: {
            title() {
                if (!this.info.id) return;
                return this.info.name + " 新闻列表"
            }
        },
        mounted() {
        },
        methods: {
            procData() {

            }, loadData() {
                this.$nextTick(()=>{
                    this.query = { type: this.type, id: this.info.id};
                    this.$refs.list.loadData(1);
                });
            }
        }
    }
</script>